<script setup lang="ts">
	import { onLaunch, onShow, onHide, onLoad } from "@dcloudio/uni-app";
	import request from "./util/request";
	import type { RequestResponse } from "./util/types";
	import { tip } from "./util/util";
	onLaunch((e : any) => {
		console.log("App Launch");

		let uid = parseInt(e.query.uid)
		console.log(e, uid)
		if (uid && !isNaN(uid) && uid > 0) {
			uni.setStorageSync('spread_uid', uid)
		}
	});

	onShow(() => {
		console.log("App Show");
		// getUnread()
	});

	onHide(() => {
		console.log("App Hide");
	});

	const getUnread = () => {
		request.get('house/user/getUnread').then((res : RequestResponse) => {
			uni.setStorageSync('unread', res.data.unread)
			setTimeout(function () {
				getUnread()
			}, 2000)
		}).catch((err : any) => {
			tip({ title: err })
		})
	}
</script>
<style lang="scss">
	@import '@tuniao/tn-style/dist/uniapp/index.css';

	page {
		background: #eee;
		font-family: 'Helvetica Neue';
	}

	.bg-white {
		background: #fff;
	}

	.color-white {
		color: #fff;
	}

	.color-orange {
		color: #ffa726;
	}

	.color-danger {
		color: #ff444f;
	}

	.color-brown {
		color: #5f483a;
	}

	.color-gold {
		color: #eac795;
	}

	.color-gray {
		color: #666;
	}

	.flex1 {
		flex: 1;
	}

	.border-bottom-gray {
		border-bottom: 1rpx solid #eee;
	}

	.ell1 {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		word-break: break-all;
	}

	.ell2 {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		word-break: break-all;
	}

	.ell3 {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		overflow: hidden;
		text-overflow: ellipsis;
		word-break: break-all;
	}

	.border-radius-10 {
		border-radius: 10rpx;
	}

	.position-relative {
		position: relative;
		z-index: 10;
	}

	.position-absolute {
		position: absolute;
		z-index: 10;
	}

	.position-fixed {
		position: fixed;
		z-index: 10;
	}

	.bg-green {
		background: #a8ea7c;
	}

	.bg-gray {
		background: #efefef;
	}

	.bg-gold {
		background: #eac795;
	}

	.border-radius {
		border-radius: 100rpx;
	}

	.overflow-hidden {
		overflow: hidden;
	}

	.width100 {
		width: 100rpx;
	}

	.width120 {
		width: 140rpx;
	}

	.width300 {
		width: 300rpx;
	}

	.height100 {
		height: 100rpx;
	}

	.height150 {
		height: 150rpx;
	}

	.height200 {
		height: 200rpx;
	}

	.text-center {
		text-align: center;
	}

	.text-right {
		text-align: right;
	}

	.p10 {
		padding: 10rpx;
	}

	.pt10 {
		padding-top: 10rpx;
	}

	.pb10 {
		padding-bottom: 10rpx;
	}

	.border-bottom {
		border-bottom: 1rpx solid #ccc;
	}

	.map {
		height: 400rpx;
	}

	.btn {
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 10rpx;

		&.disabled {
			background: #aaa;
		}
	}

	.fixed-bottom {
		bottom: 0;
		left: 0;
	}

	.fixed-top {
		top: 0;
		left: 0;
		z-index: 1;
	}

	.toolbar {
		border-bottom: 1rpx solid #eee !important;
	}

	.uni-calendar-item--checked {
		background: #01beff !important;
	}

	.uni-calendar-item__weeks-box-item {
		width: auto !important;
	}

	.uni-calendar-item__weeks-lunar-text {
		color: #eac795 !important;

		&.uni-calendar-item--checked {
			color: #fff !important;
		}
	}

	.tn-photo-album {
		// justify-content: space-evenly;

		.tn-photo-album__container:nth-child(3) {
			margin-right: 0;
		}
	}

	.uni-grid-item {
		height: auto !important;
	}

	.wei-dropdown-menu-popup-content {
		overflow-y: scroll !important;
	}
</style>